package cn.zucc.edu.bruce.iot.receiver;

import cn.zucc.edu.bruce.iot.DataDeal;

public class ReceiveRgbData extends ReceiveSensorData {
    private int red;
    private int green;
    private int blue;

    public ReceiveRgbData(byte[] bytes) {
        setSensorNumber(1);
        this.red = DataDeal.bytesToInt(bytes, 0);
        this.green = DataDeal.bytesToInt(bytes, 4);
        this.blue = DataDeal.bytesToInt(bytes, 8);
    }

    public ReceiveRgbData(int red, int green, int blue) {
        this.red = red;
        this.green = green;
        this.blue = blue;
    }

    public int getRed() {
        return red;
    }


    public int getGreen() {
        return green;
    }

    public int getBlue() {
        return blue;
    }

    public void setRed(int red) {
        this.red = red;
    }

    public void setGreen(int green) {
        this.green = green;
    }

    public void setBlue(int blue) {
        this.blue = blue;
    }

    @Override
    public String toString() {
        return super.toString() + " R: " + this.getRed() + " G: " + this.getGreen() + " B: " + this.getBlue();
    }
}
